<%@attribute name="page" required="true" type="java.lang.String"%>
<%@attribute name="id" required="true" type="java.lang.Integer"%>
<%@attribute name="sort" required="true" type="java.lang.String"%>
<%@attribute name="value" required="true" type="java.lang.String"%>
<%@attribute name="start" required="true" type="java.lang.Integer"%>
<%@attribute name="totalPages" required="true" type="java.lang.Integer"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:if test="${totalPages > 1}">
    <div class="clear"></div>
    <div class="commentPages grid_16">
        <c:if test="${id != null && !empty id && id > 0}">
            <c:set var="url_id" value="&amp;id=${id}" />
        </c:if>
        <c:if test="${sort != null && !empty sort}">
            <c:set var="url_sort" value="&amp;sort=${sort}" />
        </c:if>
        <c:if test="${value != null && !empty value}">
            <c:set var="url_value" value="&amp;value=${value}" />
        </c:if>
        <c:if test="${start == null || empty start || start < 1 || start > totalPages}">
            <c:set var="start" value="1" />
        </c:if>
        <c:set var="url" value="?page=${page}${url_id}${url_sort}${url_value}" />
        <c:set var="prev" value="${start - 1}" />
        <c:set var="next" value="${start + 1}" />
        <ul>
            <c:if test="${prev > 0}">
                <li>
                    <a href="${url}&amp;start=${prev}" title="&laquo; Prev">&laquo; Prev</a>
                </li>
            </c:if>
            <c:forEach var="i" begin="1" end="${totalPages}">
                <c:if test="${start == i}">
                    <c:set var="active" value="class=\"commentPageActive\"" />
                </c:if>
                <li>
                    <a href="${url}&amp;start=${i}" ${active}>${i}</a>
                </li>
                <c:remove var="active" />
            </c:forEach>
            <c:if test="${next <= totalPages}">
                <li>
                    <a href="${url}&amp;start=${next}" title="Next &raquo;">Next &raquo;</a>
                </li>
            </c:if>
        </ul>
    </div>
</c:if>